/**
 * 
 *汇付天下有限公司
 * Copyright (c) 2006-2013 ChinaPnR,Inc.All Rights Reserved.
 */
package com.zx.screener.dao.userCenter.impl;

import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

import com.zx.screener.dao.userCenter.OperatorDAO;
import com.zx.screener.service.userCenter.model.Operator;

/**
 * 
 * @author zhanghaijie
 * @version $Id: UserDAOImpl.java, v 0.1 2013-3-7 上午09:58:11 zhanghaijie Exp $
 */
public class OperatorDAOImpl implements OperatorDAO {

    private MongoTemplate mongoTemplate;

    /** 
     * @see com.zx.screener.dao.userCenter.OperatorDAO#createOperator(com.zx.screener.service.userCenter.model.Operator)
     */
    @Override
    public void createOperator(Operator operator) {
        mongoTemplate.insert(operator);
    }

    /** 
     * @see com.zx.screener.dao.userCenter.OperatorDAO#findOperatorByCertNum(java.lang.String)
     */
    @Override
    public Operator findOperatorByCertNum(String certNum) {
        return mongoTemplate.findOne(new Query(new Criteria("loginInfo.certNum").is(certNum)),
            Operator.class);
    }

    public void setMongoTemplate(MongoTemplate mongoTemplate) {
        this.mongoTemplate = mongoTemplate;
    }

}
